package com.imagination.applet.controller.api.response;

import com.imagination.applet.controller.view.UserPhotosVO;
import com.imagination.applet.domain.photo.model.UserPhotosResult;
//import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class UserPhotosResponse {

//    @Schema(title = "好的图片")
    private List<UserPhotosVO> goodPhotos;

//    @Schema(title = "坏的图片ID")
    private List<UserPhotosVO> badPhotos;


    public static UserPhotosResponse of(UserPhotosResult result) {
        List<UserPhotosVO> good = result.getGoodPhotos().stream()
                .map(p -> UserPhotosVO.builder()
                        .photoId(p.getId())
                        .link(p.getLink())
                        .build())
                .toList();
        List<UserPhotosVO> bad = result.getBadPhotos().stream()
                .map(p -> UserPhotosVO.builder()
                        .photoId(p.getId())
                        .link(p.getLink())
                        .build())
                .toList();

        return UserPhotosResponse.builder()
                .goodPhotos(good)
                .badPhotos(bad)
                .build();
    }
}
